<div id="displayListing">
	{title} {$listing.Title} {/title}
	{keywords} {$listing.Title} {/keywords}
	{description} {$listing.Title} {/description}
	{if $errors}
	    {foreach from=$errors key=error_code item=error_message}
			<p class="error">
				{if $error_code == 'UNDEFINED_LISTING_ID'} [[Listing ID is not defined]]
					{title} [[404 Not Found]] {/title}
				{elseif $error_code == 'WRONG_LISTING_ID_SPECIFIED'} [[There is no listing in the system with the specified ID]]
					{title} [[404 Not Found]] {/title}
				{elseif $error_code == 'LISTING_IS_NOT_ACTIVE'} [[This Job is no longer available]]
					{title} [[404 Not Found]] {/title}
				{elseif $error_code == 'NOT_OWNER'} [[You're not the owner of this posting]]
				{elseif $error_code == 'LISTING_IS_NOT_APPROVED'} [[Listing with specified ID is not approved by admin]]
					{title} [[404 Not Found]] {/title}
				{elseif $error_code == 'WRONG_DISPLAY_TEMPLATE'} [[Wrong template to display listing]]
				{/if}
			</p>
		{/foreach}
	{else}
		<script language="JavaScript" type="text/javascript" src="{$GLOBALS.site_url}/system/ext/jquery/jquery-ui.js"></script>
		<script language="JavaScript" type="text/javascript" src="{$GLOBALS.site_url}/system/ext/jquery/jquery.bgiframe.js"></script>
		<script language="JavaScript" type="text/javascript" src="{$GLOBALS.site_url}/system/ext/jquery/jquery.form.js"></script>
		<script language="JavaScript" type="text/javascript" src="{$GLOBALS.site_url}/system/ext/jquery/jquery.highlight.js"></script>

        {literal}
		<script type="text/javascript">

        function popUpWindowIframe(url, widthWin, heightWin, title) {
            $("#messageBox").dialog( 'destroy' ).html('{/literal}<img style="vertical-align: middle" src="{$GLOBALS.site_url}/system/ext/jquery/progbar.gif" alt="[[Please, wait ...]]" /> [[Please, wait ...]]{literal}');
            $("#messageBox").dialog({
                width: widthWin,
                height: heightWin,
                modal: true,
                title: title
            }).dialog( 'open' );
            $("#messageBox").html('<iframe border="0" runat="server" height="450px" width="750px" frameborder="0" src="'+url+'"></iframe>');
            return false;
        }

		function windowMessage() {
			$("#messageBox").dialog( 'destroy' ).html('You already applied');
			$("#messageBox").dialog({
				bgiframe: true,
				modal: true,
				title: 'Error',
				buttons: {
					Ok: function() {
						$(this).dialog('close');
					}
				}
			});
		}
	
	
		{/literal}
		var link = "{$GLOBALS.site_url}/flag-listing/";
		{literal}
	
		// send flagForm and show result
		function sendFlagForm() {
	
			$("#flagForm").ajaxSubmit({
				url: link,
				success: function(response, status) {
					$("#messageBox").html(response);
				}
			});
	
			return false;
		}
	
		</script>
		{/literal}

	<!-- START Listing Info Block -->
	<div id="listingInfo">
		{if $searchId != "" && $GLOBALS.user_page_uri != "/my-job-details"}
			<span class="smallLinks">
				<a href="{$GLOBALS.site_url}{$search_uri}?action=search&amp;searchId={$searchId}&amp;page={$page}#listing_{$listing.id}">[[Back to Results]]</a> |
				<a href="{$GLOBALS.site_url}/find-jobs/?searchId={$searchId}">[[Modify Search]]</a>
			</span>
		{/if}

		<div id="listingsNavigation">
			{if $searchId != "" || $GLOBALS.user_page_uri == "/my-job-details"}
				{if $prev_next_ids.prev}
					<span class="prevBtn"><a href="{$GLOBALS.site_url}/{if $GLOBALS.user_page_uri == "/my-job-details"}my-job-details{else}display-job{/if}/{$prev_next_ids.prev}/?searchId={$searchId}&amp;page={$page}">[[Previous]]</a></span>
				{else}
					{if !$prev_next_ids.prev && !$prev_next_ids.next}{else}<span class="prevBtn"><a>[[Previous]]</a></span>{/if}
				{/if}
				{if $prev_next_ids.next}
					<span class="nextBtn"><a href="{$GLOBALS.site_url}/{if $GLOBALS.user_page_uri == "/my-job-details"}my-job-details{else}display-job{/if}/{$prev_next_ids.next}/?searchId={$searchId}&amp;page={$page}">[[Next]]</a></span>
				{else}
					{if !$prev_next_ids.prev && !$prev_next_ids.next}{else}<span class="nextBtn"><a>[[Next]]</a></span>{/if}
				{/if}
			{/if}
		</div>
		<div class="clr"></div>
		<h2>{$listing.Title}</h2>
		<div class="clr"></div>

		{capture name="middleFHContent"}
		{if $acl->isAllowed('apply_for_a_job')}
			{if $isApplied}
				{capture assign='applyBtn_onClick'}onclick="windowMessage();"{/capture}
			{else}
				{if $listing.ApplicationSettings.add_parameter && $listing.ApplicationSettings.add_parameter == 2}
					{capture assign='applyBtn_onClick'}onclick="javascript:window.open('{if $listing.company_name}{$GLOBALS.site_url}/apply-now-external/?listing_id={$listing.id}{else}{$listing.ApplicationSettings.value}{/if}');"{/capture}
				{else}
					{capture assign='applyBtn_onClick'}onclick="popUpWindow('{$GLOBALS.site_url}/apply-now/?listing_id={$listing.id}&ajaxRelocate=1', 520, 480, '[[Apply now]]')"{/capture}
				{/if}
			{/if}
		{elseif $acl->getPermissionParams('apply_for_a_job') == "message"}
			{capture assign='applyBtn_onClick'}onclick="popUpWindow('{$GLOBALS.site_url}/access-denied/?permission=apply_for_a_job', 300, 300, '[[Apply now]]')"{/capture}
		{/if}
		{if isset($applyBtn_onClick)}
			<div id="applyDiv" style="margin-bottom: 10px;"><input type="button" {$applyBtn_onClick}  value='[[Apply now]]' /></div>
		{/if}
		<div id="userTools">
			<div id="userToolsItems">
				{if $GLOBALS.user_page_uri != "/my-job-details"}
					{if $acl->isAllowed('save_job')}
						<a href="{$GLOBALS.site_url}/saved-ads/?listing_id={$listing.id}" onclick="popUpWindow('{$GLOBALS.site_url}/saved-ads/?listing_id={$listing.id}&displayForm=1', 350, 300, '[[Save this Job]]', true, {if $GLOBALS.current_user.logged_in}true{else}false{/if}); return false;">[[Save this Job]]</a> |
					{elseif $acl->getPermissionParams('save_job') == "message"}
						<a href="{$GLOBALS.site_url}/saved-ads/?listing_id={$listing.id}" onclick="popUpWindow('{$GLOBALS.site_url}/access-denied/?permission=save_job', 300, 300, '[[Save this Job]]'); return false;">[[Save this Job]]</a> |
					{/if}
					{if $GLOBALS.current_user.logged_in}
						{if $acl->isAllowed('save_job')}
							<a href="{$GLOBALS.site_url}/saved-jobs">[[View Saved Jobs]]</a> |
						{elseif $acl->getPermissionParams('save_job') == "message"}
							<a href="{$GLOBALS.site_url}/saved-jobs" onclick="popUpWindow('{$GLOBALS.site_url}/access-denied/?permission=save_job', 300, 300, '[[View Saved Jobs]]'); return false;">[[View Saved Jobs]]</a> |
						{/if}
					{else}
						<a onclick="popUpWindow('{$GLOBALS.site_url}/saved-listings/?listing_type_id=job', 350, 300, 'Saved jobs'); return false;" href="{$GLOBALS.site_url}/saved-listings">[[View Saved Jobs]]</a> |
					{/if}
				{/if}
				<a href="{$GLOBALS.site_url}/tell-friends/?listing_id={$listing.id}" onclick="popUpWindow('{$GLOBALS.site_url}/tell-friends/?listing_id={$listing.id}', 400, 470, '[[Tell a Friend]]'); return false;" id="message_link">[[Tell a Friend]]</a> |
				{if $acl->isAllowed('flag_job')}
					<a href="{$GLOBALS.site_url}/flag-listing/?listing_id={$listing.id}" onclick="popUpWindow('{$GLOBALS.site_url}/flag-listing/?listing_id={$listing.id}', 400, 350, '[[Flag Job]]'); return false;" id="message_link">[[Flag This Job]]</a> |
				{elseif $acl->getPermissionParams('flag_job') == "message"}
					<a href="{$GLOBALS.site_url}/flag-listing/?listing_id={$listing.id}" onclick="popUpWindow('{$GLOBALS.site_url}/access-denied/?permission=flag_job', 300, 300, '[[Flag This Job]]'); return false;" id="message_link">[[Flag This Job]]</a> |
				{/if}
				<a target="_blank" href="{$GLOBALS.site_url}/print-listing/?listing_id={$listing.id}">[[Print This Ad]]</a> |
                {if $listing.latitude && $listing.longitude}
                    <a href="{$GLOBALS.site_url}/display-job-map/?listing_id={$listing.id}&amp;searchId={$searchId}&amp;view=map" onclick="popUpWindowIframe('{$GLOBALS.site_url}/display-job-map/?listing_id={$listing.id}&amp;searchId={$searchId}&amp;view=map&amp;lightbox=1', 800, 500, '[[Map]]'); return false;">[[View Map]]</a>
                {/if}
			</div>
			<span></span>
		</div>
		<div class="clr"><br/></div>

		<div class="ratingComments">
			{if $show_comments != 0 && $acl->isAllowed('add_job_comments')}
				<a href="#comment_1">[[Comments]] (+{$listing.comments_num})</a>
			{elseif $acl->getPermissionParams('add_job_comments') == "message"}
				<a href="#comment_1"  onclick="popUpWindow('{$GLOBALS.site_url}/access-denied/?permission=add_job_comments', 300, 300, '[[Comments]]'); return false;">[[Comments]] (+{$listing.comments_num})</a>
			{/if}

			{if $show_rates !=0 && $acl->isAllowed('add_job_ratings')}
				<p>[[Rate This Job]]: {include file="rating.tpl" listing=$listing}</p>
			{/if}
		</div>
		<div class="clr"><br/></div>
		{/capture}

		<div class="clr"></div>
		{* >>>>>>>>>>>>> FIELDS >>>>>>>>>>>>>>>> *}
		{include file="../builder/bf_displaylisting_fieldsholders.tpl"}
		{* <<<<<<<<<<<<< FIELDS <<<<<<<<<<<<<<<< *}
		<div class="clr"><br/></div>

		{if !$myListing && $GLOBALS.plugins.ShareThisPlugin.active == 1 && $GLOBALS.settings.display_on_job_page == 1}
			{$GLOBALS.settings.header_code}
			{$GLOBALS.settings.code}
		{/if}
		{* SOCIAL PLUGIN: FACEBOOK LIKE BUTTON *}
			{module name="social" function="facebook_like_button" listing=$listing type="Job"}
		    {* / SOCIAL PLUGIN: FACEBOOK LIKE BUTTON *}
		    {* SOCIAL PLUGIN: LINKEDIN SHARE BUTTON *}
			{module name="social" function="linkedin_share_button" listing=$listing}
		    {* / SOCIAL PLUGIN: LINKEDIN SHARE BUTTON *}
		<div class="clr"><br/></div>
		{if $acl->isAllowed('add_job_comments')}
			{include file="listing_comments.tpl" listing=$listing }
			<div class="clr"><br/></div>
		{/if}

		{if isset($applyBtn_onClick)}
			<div id="applyDiv"><input type="button" {$applyBtn_onClick}  value='[[Apply now]]' /></div>
		{/if}
	{* >>>>> LISTING PREVIEW >>>>> *}
		<div class="clr"><br/></div>
		{if $GLOBALS.user_page_uri == '/job-preview'}
			<div class="preview-buttons">
				<form action="{$referer}" method="post">
					<input type="hidden" name="from-preview" value="1" />
					<input type="submit" name="edit_temp_listing" value="[[Edit:raw]]" class="button" id="listingPreview"/>
					<input type="submit" name="action_add" value="[[Post:raw]]" class="button" />
				</form>
			</div>
		{/if}
	{* <<<<< LISTING PREVIEW <<<<< *}
	</div>



	<!-- START Company Info Block -->
{if !$listing.Confidential}
	<div id="userInfo">
		<div id="informationBlock">
			<div id="blueBoxStart"></div>
			<div id="blueBoxBg">[[Company Info]]</div>
			<div id="blueBoxEnd"></div>
		</div>
		<div id="informationBlockBg" class="compProfileInfo">
			{if $listing.anonymous != 1 || $applications.anonymous === 0 }
				{if $listing.user.Logo.file_url}
					<center><img src="{$listing.user.Logo.file_url}" alt="" /></center><br/>
				{/if}
				{* Check for JobG8 listings property *}
				<strong>{if $listing.company_name}{$listing.company_name}{else}{$listing.user.CompanyName}{/if}</strong>
				{if $allowViewContactInfo}<br />{$listing.user.Address}{/if}
				<br />{if $listing.user.City}{$listing.user.City}, {/if}[[$listing.user.State]] {if $listing.user.Country}([[$listing.user.Country]]){/if}
				<br/><br/>
				{if $allowViewContactInfo}
				<strong>[[FormFieldCaptions!Phone]]</strong>: {$listing.user.PhoneNumber}<br/>
				<strong>[[FormFieldCaptions!Web]]</strong>: <a href="{if strpos($listing.user.WebSite, 'http://') === false}http://{/if}{$listing.user.WebSite}" target="_blank">{$listing.user.WebSite}</a><br/><br/>
				{elseif $acl->getPermissionParams('view_job_contact_info') == "message"}
					{module name="miscellaneous" function="access_denied" permission="view_job_contact_info"}<br/>
				{/if}
                {if !$listing.company_name}
                    {if $allow_save_to_contacts}
                        <a href="{$GLOBALS.site_url}/private-messages/contacts/?pm_action=save_contact&amp;user_id={$listing.user.id}" onclick="popUpWindow('{$GLOBALS.site_url}/private-messages/contacts/?pm_action=save_contact&amp;user_id={$listing.user.id}', 560, 100, '[[Save Contact]]', true, {if $GLOBALS.current_user.logged_in}true{else}false{/if}); return false;"   class="linkArrow">[[Save Contact]]</a><br/>
                    {/if}
                {/if}

				{* Check for JobG8 listings property to post link to company profile *}
				{if $listing.company_name}
					<a href="{$GLOBALS.site_url}/search-results-jobs/?action=search&amp;username[equal]={$listing.user.id}&company_name[equal]={$listing.company_name}" class="linkArrow">[[Company Profile]]</a>
				{else}
					{if strpos($listing.user.CompanyName, '-') !== false}
						<a href="{$GLOBALS.site_url}/search-results-jobs/?action=search&amp;username[equal]={$listing.user.id}" class="linkArrow">[[Company Profile]]</a><br/>
					{else}
						<a href="{$GLOBALS.site_url}/company/{$listing.user.id}/{$listing.user.CompanyName|replace:" ":"-"|escape:"url"}" class="linkArrow">[[Company Profile]]</a><br/>
					{/if}
				{/if}
				{if !$listing.company_name}
					{if $acl->isAllowed('use_private_messages')}
						<a href="{$GLOBALS.site_url}/private-messages/send/?to={$listing.user.id}{if $listing.subuser}&amp;cc={$listing.subuser.id}{/if}" onclick="popUpWindow('{$GLOBALS.site_url}/private-messages/aj-send/?to={$listing.user.id}&ajaxRelocate=1{if $listing.subuser}&cc={$listing.subuser.id}{/if}', 560, 400, '[[Send Private Message]]', true, {if $GLOBALS.current_user.logged_in}true{else}false{/if}); return false;"  class="linkArrow">[[Send Private Message]]</a>
					{elseif $acl->getPermissionParams('use_private_messages') == "message"}
						<a href="{$GLOBALS.site_url}/private-messages/send/?to={$listing.user.id}{if $listing.subuser}&amp;cc={$listing.subuser.id}{/if}" onclick="popUpWindow('{$GLOBALS.site_url}/access-denied/?permission=use_private_messages', 300, 300, '[[Send Private Message]]'); return false;"  class="pm_send_link">[[Send Private Message]]</a>
					{/if}
				{/if}
				{* LINKEDIN: COMPANY INSIDER WIDGET *}
				{module name="social" function="company_insider_widget" companyName=$listing.user.CompanyName}
				{* end of : LINKEDIN: COMPANY INSIDER WIDGET *}
				<div class="clr"></div>
			{else}
				<center><strong>[[Anonymous User Info]]</strong></center>
			{/if}
			<br/>
			{foreach from=$video_fields item=field_id}
				{if $listing.$field_id.file_url != ""}<br/><center>{include file="video_player.tpl"}</center><br/>{/if}
			{/foreach}

			{if $listing.YouTube}
				<br/><center><strong>[[FormFieldCaptions!youtube]]:</strong></center>
				{display property=YouTube}
			{/if}

			<center>
				{foreach from=$listing.pictures key=key item=picture name=picimages }
					<br/><a target="_black" href ="{$picture.picture_url}"> <img src="{$picture.thumbnail_url}" border="0" title="{$picture.caption}" alt="{$picture.caption}" /></a>
				{/foreach}
			</center>
		</div>
	</div>
{/if}
	<!-- END Company Info Block -->
	{/if}
</div>

<script>
{if $keywordsHighlight}
	$("#listingInfo").highlight("{$keywordsHighlight}");
{/if}
</script>